﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace TwitterChat
{
    public class MessageDTO
    {
        public int MessageId { get; set; }
        public string Message { get; set; }
        public int ChannelId { get; set; }
        public string TimeStamp { get; set; }

        public static MessageDTO CreateFromMessage(Message messageFromDb)
        {
            MessageDTO message = new MessageDTO();
            message.MessageId = messageFromDb.MessageId;
            message.Message = messageFromDb.Message1;
            message.ChannelId = messageFromDb.ChanelId;
            message.TimeStamp = messageFromDb.TimeStamp;
            return message;
        }

        public Message ToMessage()
        {
            Message newMessage = new Message();
            newMessage.MessageId = this.MessageId;
            newMessage.Message1 = this.Message;
            newMessage.ChanelId = this.ChannelId;
            newMessage.TimeStamp = this.TimeStamp;
            return newMessage;
        }
    }
}